package com.realtyreg.service.jpa;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.realtyreg.domain.entity.realty.Realty;
import com.realtyreg.repository.RealtyRepository;
import com.realtyreg.service.RealtyService;

import java.util.List;

/**
 * @author Petro
 * @created 04.09.2012 23:24
 */
@Service("realtyService")
@Repository
@Transactional(rollbackFor = java.lang.Exception.class)
public class RealtyServiceImpl implements RealtyService {
    @Autowired
    private RealtyRepository realtyRepository;

    @Transactional(readOnly = true)
    public List<Realty> findAll() {
        return realtyRepository.findAll();
    }

    @Transactional(readOnly = true)
    public Realty findOne(Long id) {
        return realtyRepository.findOne(id);
    }

    public Realty save(Realty realty) {
        return realtyRepository.save(realty);
    }

    public void delete(Long id) {
        realtyRepository.delete(id);
    }
}
